package com.gouwudai.gobbs.dao.impl;

import org.apache.log4j.Logger;

import com.gouwudai.gobbs.common.IPageList;
import com.gouwudai.gobbs.dao.IBusinessDAO;
import com.gouwudai.gobbs.pojo.TbbsBusiness;
import com.litt.core.exception.BusiException;

/**
 * 
 * <pre>
 *  Title:交易信息DAO
 *  Description: 交易信息DAO  
 * </pre>
 * 
 * @author <a href="mailto:littcai@hotmail.com">空心大白菜</a>
 * @date 2007-3-29
 * @version 1.0
 * <pre>
 * 修改记录
 *    修改后版本:     修改人：  修改日期:     修改内容: 
 * </pre>
 */
public class BusinessDAOImpl extends BaseDAOImpl implements IBusinessDAO 
{
	private static final Logger logger = Logger.getLogger(BusinessDAOImpl.class);	
	private static final String BUSI_NAME = "交易信息";
	
	/**
	 * @param tbbsBusiness
	 * @throws BusiException
	 */
	public void save(TbbsBusiness tbbsBusiness)
	{    		
		super.saveObject(tbbsBusiness);		
	}
	
	/**
	 * @param id
	 * @return
	 * @throws BusiException
	 */
	public TbbsBusiness load(Integer id)
	{
		return (TbbsBusiness)super.loadObject(TbbsBusiness.class, id);
	} 
    
    /**
	 * @param businessId
	 * @throws BusiException
	 */
    public void delete(Integer businessId)
    {
        super.deleteObject(TbbsBusiness.class.getName(),"businessId",businessId);
    }
    
    /**
	 * @param userId
	 * @param pageIndex
	 * @param pageSize
	 * @return
	 * @throws BusiException
	 */
    public IPageList listPage(Integer userId,int pageIndex,int pageSize)
    {	
    	StringBuilder listSql = new StringBuilder("SELECT A.*,B.DICT_CONTENT AS BUSINESS_TYPE_NAME FROM TbbsBusiness A,TbbsDictParam B WHERE A.USER_ID='");
    	listSql.append(userId);
    	listSql.append("' AND (B.DICT_TYPE='B001' AND B.DICT_VALUE=A.BUSINESS_TYPE)");
    	return super.listSqlPage(listSql.toString(),pageIndex,pageSize);
    } 

}
